﻿<%@ Application Language="C#" %>
<%@ Import Namespace="System.Web.Routing" %>

<script runat="server">
    public static void RegisterRoutes(RouteCollection routes)
    {
        RouteTable.Routes.Ignore("{resource}.axd/{*pathInfo}");
        routes.MapPageRoute("Index", "Index.html", "~/Index.aspx");
        routes.MapPageRoute("Search", "{keyword}/{category}/Timkiem.html", "~/Search.aspx");
        routes.MapPageRoute("category", "{categoryName}/Category.html", "~/chitiet.aspx");
        //routes.MapPageRoute("DetailCompany", "{Doanhnghiep_ID}/Thongtindoanhnghiep.html", "~/User/DetailCompany.aspx");
        routes.MapPageRoute("Error", "Loi.html", "~/Errors.aspx");
        // User action -------------------------------------------------------------------------------
        routes.MapPageRoute("Register", "Dangki.html", "~/User/Register.aspx");
        routes.MapPageRoute("Login", "Login.html", "~/User/Login.aspx");
        routes.MapPageRoute("Password", "quenmatkhau.html", "~/User/forgotPassword.aspx");
        routes.MapPageRoute("UpdateInfoUser", "Capnhatthongtin.html", "~/User/UpdateInfo.aspx");
        routes.MapPageRoute("InfoUser", "Thongtincanhan.html", "~/User/userInfo.aspx");
        routes.MapPageRoute("changepass", "Doimatkhau.html", "~/User/ChangePassWord.aspx");
        routes.MapPageRoute("UpgradeVIP", "NangcapVIP.html", "~/User/UpgradeVIP.aspx");
        routes.MapPageRoute("logout", "Thoat.html", "~/logout.aspx");
        routes.MapPageRoute("Active", "{username}/KichhoatTaikhoan.html", "~/User/ActiveAccount.aspx");
        routes.MapPageRoute("ViewUser", "{User}.html", "~/User/userInfo.aspx");
        routes.MapPageRoute("DNInfo", "Quanlytaikhoan.html", "~/User/CompanyManager.aspx",true);
        routes.MapPageRoute("QuanlyQuangcao", "QuanlyQuangcao.html", "~/BannerManager.aspx");
        // EShop -------------------------------------------------------------------------------
        routes.MapPageRoute("CurrentPoint", "CurrentPoint.html", "~/EShop/Points.aspx");
        routes.MapPageRoute("BuyPoint", "{user}/{money}/Buy.html", "~/EShop/BuyPoint.aspx");
        routes.MapPageRoute("Checkout", "{service}/{status}/{user}/{point_munber}/Buy.html", "~/EShop/BuyPoint.aspx");
        routes.MapPageRoute("EShop", "EShop.html", "~/EShop/EShop.aspx");
        routes.MapPageRoute("AddAds", "NewAds.html", "~/EShop/NewAds.aspx");
        //  Advertis--------------------------------------------------------------------------
        routes.MapPageRoute("Advertis", "{position}/Dangquangcao.html", "~/AddAdvertis.aspx");
        routes.MapPageRoute("Wheel", "{Doanhnghiep_ID}/Thongtindoanhnghiep.html", "~/User/DetailCompany.aspx");
    }
    void Application_Start(object sender, EventArgs e) 
    {
        // Code that runs on application startup
        RegisterRoutes(RouteTable.Routes);
    }
    
    void Application_End(object sender, EventArgs e) 
    {
        //  Code that runs on application shutdown
        Response.RedirectToRoute("logout");
    }
        
    void Application_Error(object sender, EventArgs e) 
    { 
        // Code that runs when an unhandled error occurs
        Response.RedirectToRoute("Error");
    }

    void Session_Start(object sender, EventArgs e) 
    {
        // Code that runs when a new session is started
        Response.RedirectToRoute("Index");
    }

    void Session_End(object sender, EventArgs e) 
    {
        // Code that runs when a session ends. 
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is set to StateServer 
        // or SQLServer, the event is not raised.

    }
       
</script>
